#
# Copyright (C) 2009-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=libmemcached_lede
PKG_VERSION:=1.0.18
PKG_RELEASE:=1

PKG_SRC_NAME:=libmemcached
PKG_SOURCE:=$(PKG_SRC_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://launchpad.net/libmemcached/1.0/1.0.18/+download/
PKG_HASH:=e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SRC_NAME)-$(PKG_VERSION)

PKG_MAINTAINER:=Joyplayer <joyplayer@126.com>
PKG_LICENSE:=Sleepycat
PKG_LICENSE_FILES:=LICENSE

PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
#CMAKE_BINARY_SUBDIR:=build
#CMAKE_INSTALL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/libmemcached_lede
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=(LEDE) Memcached library
  DEPENDS:=+memcached_lede +libstdcpp
  URL:=https://launchpad.net/libmemcached/
endef

define Package/libmemcached_lede/description
  (LEDE) Memcached library.
endef

define Package/libmemcached_lede/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
endef

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
	$(INSTALL_DIR) $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
		       $(1)/usr/lib/pkgconfig
endef

$(eval $(call BuildPackage,libmemcached_lede))
